//
//	 ______    ______    ______    
//	/\  __ \  /\  ___\  /\  ___\   
//	\ \  __<  \ \  __\_ \ \  __\_ 
//	 \ \_____\ \ \_____\ \ \_____\ 
//	  \/_____/  \/_____/  \/_____/ 
//
//	Powered by BeeFramework
//
//
//  Board_iPhone_Login.m
//  DingDing
//
//  Created by LHL on 14/11/20.
//  Copyright (c) 2014年 com.gordon. All rights reserved.
//

#import "Board_iPhone_Login.h"
#import "Board_iPhone_Login2.h"
#import "Board_iPhone_Register1.h"
#import "Board_iPhone_UpdatePassWord.h"
#import "AddPet.h"
#import "Board_iPhone_Settings.h"
#import "MainNearBy_Board.h"
#import "PersonalHomePage.h"
//#import <ShareSDK/ShareSDK.h>
#import "dynamicsVC.h"
#import "PhotoTableViewController.h"
#pragma mark -

@interface Board_iPhone_Login()
{
	//<#@private var#>
}
@end

@implementation Board_iPhone_Login{
//    CLLocationManager *location;
}
SUPPORT_AUTOMATIC_LAYOUT( YES )
SUPPORT_RESOURCE_LOADING( YES )
DEF_OUTLET(BeeUIButton, login)
DEF_OUTLET(BeeUITextField, phoneResgister)
DEF_OUTLET(BeeUIButton, weiboLogin)
DEF_OUTLET(BeeUIButton, qqLogin)
DEF_MODEL(oneKeyLogin, ioneKeyLogin)
- (void)load
{
    self.ioneKeyLogin = [oneKeyLogin modelWithObserver:self];
}

- (void)unload
{
}

ON_SIGNAL3(oneKeyLogin, RELOADED, SIGNAL){

    if ( [self.ioneKeyLogin.code isEqualToString:@"100"]) {
        MainNearBy_Board *main = [[MainNearBy_Board alloc]init];
        [self.navigationController pushViewController:main animated:YES];
    }else if([self.ioneKeyLogin.code isEqualToString:@"200"]){
        AddPet *add = [[AddPet alloc]init];
        [self.navigationController pushViewController:add animated:YES];
    }else{
        [self presentMessageTips:self.ioneKeyLogin.msg];
    }
    
}

ON_SIGNAL3(oneKeyLogin, RELOADING, SIGNAL){
    [self presentLoadingTips:@"登录中"];
}

ON_SIGNAL3(oneKeyLogin, FAILED, SIGNAL){
    [self presentMessageTips:@"登录失败"];
}

#pragma mark - Signal

ON_CREATE_VIEWS( signal )
{
    self.navigationBarShown = NO;
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.barStyle = UIStatusBarStyleLightContent;
}


ON_DELETE_VIEWS( signal )
{
}

ON_LAYOUT_VIEWS( signal )
{
}

ON_WILL_APPEAR( signal )
{
    self.navigationBarShown = NO;
}

ON_DID_APPEAR( signal )
{
}

ON_WILL_DISAPPEAR( signal )
{
}

ON_DID_DISAPPEAR( signal )
{
}

ON_SIGNAL3( BeeUINavigationBar, LEFT_TOUCHED, signal )
{
}

ON_SIGNAL3( BeeUINavigationBar, RIGHT_TOUCHED, signal )
{
    
}
ON_SIGNAL3(BeeUIButton, login, SIGNAL){

    Board_iPhone_Login2 *login2 = [[Board_iPhone_Login2 alloc]init];
    [self.navigationController pushViewController:login2 animated:YES];
    
}

ON_SIGNAL3(BeeUIButton, phoneResgister, SIGNAL){
    Board_iPhone_Register1 *res = [[Board_iPhone_Register1 alloc]init];
    [self.navigationController pushViewController:res animated:YES];
    
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    for (BeeUITextField *t  in self.view.subviews) {
        [t resignFirstResponder];
    }
}

ON_SIGNAL3(BeeUIButton, weiboLogin, SIGNAL){
   

}

ON_SIGNAL3(BeeUIButton, qqLogin, SIGNAL){
//    AddPet *pet = [[AddPet alloc]init];
//    [self.navigationController pushViewController:pet animated:YES];
}

@end
